package com.zhang.crm.controller;

import com.github.pagehelper.PageInfo;
import com.zhang.crm.pojo.TClueRemark;
import com.zhang.crm.result.R;
import com.zhang.crm.service.ClueRemarkService;
import com.zhang.crm.service.ClueService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class ClueRemarkController {
    @Resource
    private ClueRemarkService clueRemarkService;
    @GetMapping("api/getClueRemark")
    public R getClueRemarks(@RequestParam("clueId")Integer clueId, @RequestParam("current")Integer current) {
        PageInfo<TClueRemark> info = clueRemarkService.getRemarkList(clueId, current);
        return R.OK(info);
    }

    @PostMapping("api/addClueRemark")
    public R addClueRemark(@RequestBody TClueRemark tClueRemark){
        Boolean b = clueRemarkService.addClue(tClueRemark);
        return  b ? R.OK() : R.FAIL("添加失败");
    }

    @PutMapping("api/updateRemark")
    public R updateRemark(@RequestBody TClueRemark tClueRemark){
        Boolean b = clueRemarkService.upDateClue(tClueRemark);
        return  b ? R.OK() : R.FAIL("添加失败");
    }
    @DeleteMapping("api/logicDeleteClueRemark")
    public R logicDeleteClueRemark(@RequestParam("clueRemarkId") Integer clueRemarkId){
        Boolean b = clueRemarkService.upDateClueDelete(clueRemarkId);
        return  b ? R.OK() : R.FAIL("添加失败");
    }
}
